import { VComponent, computed } from 'v3-mini';
import { system, ratio, dpr, dpi } from '../../utils/global'

VComponent({
    properties: {
        position: String,
        unit: {
            type: String,
            value: 'cm'
        }
    },
    setup(props) {
        let max_width = {
            cm: computed(() => Math.ceil(system.width / dpr / 96 / ratio.value * 2.54)),
            in: computed(() => Math.ceil(system.width / dpr / 96 / ratio.value)),
        }
        let max_height = {
            cm: computed(() => Math.ceil(system.height / dpr / 96 / ratio.value * 2.54)),
            in: computed(() => Math.ceil(system.height / dpr / 96 / ratio.value)),
        }
        
        return {
            max_width,
            max_height,
            ratio,
        }
    }
})